package com.gc.ip;

import java.beans.PropertyChangeListener;

import javax.swing.JComponent;


public interface IPEditor
{
	/** Bound property name for <code>ipType</code>. */
	public static final String IP_TYPE_PROPERTY = "ipType";
	
	/** Bound property name for <code>ipAddress</code>. */
	public static final String IP_ADDRESS_PROPERTY = "ipAddress";
	
	/** Bound property name for <code>text</code>. */
	public static final String TEXT_PROPERTY = "text";

	/**
	 * 
	 * Returns the IPAddress.
	 * 
	 * @return the IPAddress
	 */
	public IPAddress getIPAddress();

	/**
	 * Sets the IPAddress. This should be implemented as a bound property,
	 * firing the "ipAddress" property.
	 * 
	 * @param ipAddress
	 *            the ipAddress to set
	 */
	public void setIPAddress(IPAddress ipAddress);

	/**
	 * Returns the UI component, e.g. the actual JTextField implementing the
	 * editor.
	 * 
	 * @return the UI component
	 */
	public JComponent getUiComponent();

	/**
	 * Adds a property change listener that should be added to the implementing
	 * UI component. The UI component should fire a "ipAddress" property if the
	 * ipAddress changes.
	 * 
	 * @param listener
	 *            the property change listener.
	 */
	public void addPropertyChangeListener(PropertyChangeListener listener);

	/**
	 * Adds a property change listener that should be added to the implementing
	 * UI component. The UI component should fire a "ipAddress" property if the
	 * ipAddress changes.
	 * 
	 * @param propertyName
	 *            the property name, e.g. "ipAddress"
	 * @param listener
	 *            the property change listener.
	 */
	public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);

	/**
	 * Removes a property change listener.
	 * 
	 * @param listener
	 *            the property change listener.
	 */
	public void removePropertyChangeListener(PropertyChangeListener listener);

	/**
	 * Removes the listener from the date editor's property change listeners for
	 * the specific property.
	 * 
	 * @param propertyName
	 *            the property to listen for, e.g. "ipAddress"
	 * @param listener
	 *            the listener
	 */
	public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
}
